Router = require('koa-router')
{isPlainObject} = require('lodash')

module.exports = (middleware,dict)->
    route = new Router()

    if middleware
        if isPlainObject(middleware)
            dict = middleware
        else
            for i in middleware
                route.use i

    if dict
        for k,v of dict
            route[k](v)

    return route
